package com.eastfair.gateway;

import com.eastfair.core.context.StaticContextUtil;
import com.eastfair.log.LampMdcAdapterInitializer;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

import static com.eastfair.constant.BizConstant.UTIL_PACKAGE;

/**
 * 网关
 * @Author ligang
 * @Date 2020/3/16 15:02
 */
//@SpringBootApplication(exclude = DruidDataSourceAutoConfigure.class)
@SpringBootApplication()
@EnableDiscoveryClient
@EnableFeignClients({UTIL_PACKAGE})
@ComponentScan({
        UTIL_PACKAGE
})
@Configuration
@MapperScan(basePackages = {"com.eastfair.gateway.dao"})
//@EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true)
public class GatewayApplication {

//    @Autowired
//    DatabaseProperties databaseProperties;


    public static void main(String[] args) {
//        SpringApplication.run(GatewayApplication.class, args);
        SpringApplication application = new SpringApplication(GatewayApplication.class);
        application.addInitializers(new LampMdcAdapterInitializer());
        application.run(args);

        //系统重启时间
        StaticContextUtil.setReLoadTime(System.currentTimeMillis());
    }


}
